﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Demonstartor
{
    class InvolvedParameter
    {
        public string Name { get; set; }
        public string Description { get; set; }
        public string Reason { get; private set; }
        public bool Sin;
        public bool Cos;

        public InvolvedParameter(string Name, string Description, string Reason)
        {
            if ((Name.IndexOf("sin") == Name.Length - 3) && (Name.Length > 3))
            {
                Sin = true;
                Cos = false;

                this.Name = Name.Remove(Name.Length - 3);
            }
            else if ((Name.IndexOf("cos") == Name.Length - 3) && (Name.Length > 3))
            {
                Sin = false;
                Cos = true;

                this.Name = Name.Remove(Name.Length - 3);
            }
            else
            {
                Sin = false;
                Cos = false;

                this.Name = Name;
            }

            this.Description = Description;
            this.Reason = Reason;

        }

        public override string ToString()
        {
            if (Sin)
                return Description + "(Sin)";
            else if (Cos)
                return Description + "(Cos)";
            else
                return Description;
        }

        public override int GetHashCode()
        {
 	         return (int)Name[0];
        }

        public override bool  Equals(object obj)
        {
            if (obj.GetType() == this.GetType())
                return (InvolvedParameter)obj == this;
            else
                return false;
        }

        public static bool operator==(InvolvedParameter A, InvolvedParameter B)
        {
            return (A.Name == B.Name) && (A.Sin == B.Sin) && (A.Cos == B.Cos);
        }

        public static bool operator!=(InvolvedParameter A, InvolvedParameter B)
        {
            return (A.Name != B.Name) || (A.Sin != B.Sin) || (A.Cos != B.Cos);
        }

        public static InvolvedParameter Density()
        {
            InvolvedParameter IP = new InvolvedParameter("Оценка", "Оценка", "Too low");
            return IP;
        }

        public static InvolvedParameter BorderLine()
        {
            InvolvedParameter IP = new InvolvedParameter("Граница", "Граница", "");
            return IP;
        }
    }
}
